// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose: Declaration of the CMessageDialog.
//   $Id$
// MessageDialog.h : Declaration of the CMessageDialog


#ifndef __MESSAGEDIALOG_H_
#define __MESSAGEDIALOG_H_

#include "resource.h"       // main symbols
#include <atlhost.h>

/////////////////////////////////////////////////////////////////////////////
// CMessageDialog
#include "XFormsXformsElement.h"
DWORD WINAPI setCloseTimeout(LPVOID pvdDlg);

class CMessageDialog : 
	public CAxDialogImpl<CMessageDialog>
{
friend DWORD WINAPI setCloseTimeout(LPVOID pvdDlg);
private:
	CComBSTR m_sText;
	bool m_bNavigate;
	bool m_bIsModal;
	long m_lTimeoutMS;
	CXFormsXFormsElement * m_pXForms;
public:
	bool m_bShutDown;
	DWORD m_IDThread;

	CMessageDialog(BSTR sText,bool bNavigate,bool bIsModal,CXFormsXFormsElement* pForm, long lTimeoutMS=-1);

	CMessageDialog();

	~CMessageDialog();

	enum { IDD = IDD_MESSAGEDIALOG };

BEGIN_MSG_MAP(CMessageDialog)
	MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
//	COMMAND_ID_HANDLER(IDOK, OnOK)
	COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
	MESSAGE_HANDLER(WM_SHOWWINDOW, OnShowWindow)
	MESSAGE_HANDLER(WM_SIZE, OnSize)
END_MSG_MAP()
// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//	LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

	LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

	HANDLE m_hTimer;
};

#endif //__MESSAGEDIALOG_H_
